/**
 * author      : dormi330
 * date        : 2018/6/26
 * project     : mybatis
 * description : adaptor 会员服务
 */

package com.deep.trade.adaptor.required.member;

import com.deep.trade.adaptor.required.IdService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import com.deep.trade.adaptor.required.MemberAddress;

import javax.annotation.PostConstruct;

@Service
public class MemberService {

    private Member mockMember;
    private MemberAddress address;

    private Logger logger = LoggerFactory.getLogger(this.getClass().getName());

    @PostConstruct
    public void init() {
        mockMember = new Member();
        mockMember.setName("用户A");
        mockMember.setId(IdService.MEMBER_ID);

        address = new MemberAddress();
        address.setId(IdService.ADDRESS_ID);
        address.setMemberId(mockMember.getId());
        address.setProviceName("广东");
        address.setCityName("广州");
        address.setDistrictName("天河区");
        address.setStreetName("天园街道");
        address.setDetailAddress("棠下村999号");
        address.setPostCode("123456");
        address.setReceiverName("吴中勤");
        address.setReceiverPhone("18612341234");

        logger.warn("MemberService 初始化, 添加测试数据 ");
    }

    public Member memberOfId(String tenantCode, String memberId) {
        return mockMember;
    }

    public MemberAddress addressOfMember(String tenantCode, String memberId, String addressId) {
        return address;
    }

}
